package com.boolib.animate.framework.web;


import com.alibaba.fastjson.JSON;
import com.boolib.animate.commons.Consts;
import com.boolib.animate.framework.entity.AnimateChapter;
import com.boolib.animate.framework.entity.AnimateChapterContent;
import com.boolib.animate.framework.service.advice.AnimateChapterCommentService;
import com.boolib.animate.framework.service.advice.AnimateChapterContentService;
import com.boolib.animate.framework.service.base.impl.BaseAnimateChapterService;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @author nier
 * @create 2020-02-20 18:37
 */
@Slf4j
@RequestMapping("/api/content")
@RestController
public class AnimateChapterContentController {

    @Autowired
    private AnimateChapterContentService animateChapterContentService;


    @GetMapping
    public PageInfo<AnimateChapterContent> queryChapterList(
            @RequestParam("workId") Long workId,
            @RequestParam(value = "chapterId" ) Long chapterId,
            @RequestParam(value = "page",defaultValue = "0")Integer page,
            @RequestParam(value = "size",defaultValue = "1")Integer size
                                                 ){

        final PageInfo<AnimateChapterContent> content = animateChapterContentService.getContent(workId, chapterId, page, size);
        log.info(JSON.toJSONString(content));
        return content;

    }



}
